package http

import (
	sessionHandler "gitee.com/zaiqiang231/go-base-session/app/http/handler"
	httpHandler "gitee.com/zaiqiang231/zcamp-service-camp/app/http/handler"
	"github.com/gin-gonic/gin"
)

func InitRouter(g *gin.Engine) {
	g.Use(gin.Logger(), gin.Recovery())
	//跨域 设置
	g.Use(sessionHandler.Cors())
	//原子参数
	g.Use(sessionHandler.AtomFunc)

	public := g.Group("/public")
	{
		public.POST("/createBanner", httpHandler.AuthCheckFunc, httpHandler.CreateBanner)
		public.POST("/updateBanner", httpHandler.AuthCheckFunc, httpHandler.UpdateBanner)
		public.POST("/deleteBannerList", httpHandler.AuthCheckFunc, httpHandler.DeleteBannerList)
		public.POST("/getBannerList", httpHandler.GetBannerList)

		public.GET("/banner/list", httpHandler.BannerList)
		public.POST("/module/wx/miniacode", httpHandler.GetWXACodeURL)

	}

	camp := g.Group("/camp")
	{
		camp.POST("/getCampList", httpHandler.GetCampList)
		camp.POST("/deleteCampList", httpHandler.AuthCheckFunc, httpHandler.DeleteCampList)
		camp.POST("/createCamp", httpHandler.AuthCheckFunc, httpHandler.CreateCamp)
		camp.POST("/updateCamp", httpHandler.AuthCheckFunc, httpHandler.UpdateCamp)
		camp.POST("/campListSearch", httpHandler.CampListSearch)
		camp.POST("/campListRank", httpHandler.CampListRank)   //地区榜单，计算方式先简单算
		camp.POST("/campNationNum", httpHandler.CampNationNum) //筛选全国营地个数

		camp.GET("/detail", httpHandler.CampDetail) //营地详情
		camp.POST("/addCollect", httpHandler.AuthCheckFunc, httpHandler.AddCollect)
		camp.GET("/protocol/green/agree/status", httpHandler.GreenAgreeStatus)

		district := camp.Group("/district")
		district.POST("/getDistrictTreeTotal", httpHandler.GetDistrictTreeTotal)
		district.POST("/getAdCodeList", httpHandler.GetAdCodeList)
		district.POST("/getDistrictTreePartial", httpHandler.GetDistrictTreePartial)
		district.GET("/getProvinceAndCityList", httpHandler.GetProvinceAndCityList)

		condition := camp.Group("/condition")
		condition.POST("/getConditionList", httpHandler.GetConditionList)
		condition.POST("/deleteConditionList", httpHandler.AuthCheckFunc, httpHandler.DeleteConditionList)
		condition.POST("/createCondition", httpHandler.AuthCheckFunc, httpHandler.CreateCondition)
		condition.POST("/updateCondition", httpHandler.AuthCheckFunc, httpHandler.UpdateCondition)
		condition.POST("/getConditionTree", httpHandler.GetConditionTree)
		//优化逻辑后
		condition.POST("/getConditionTree2", httpHandler.GetConditionTree2)

		condition.GET("/hotCondition", httpHandler.HotCondition)

	}

	post := g.Group("/post")
	{
		post.POST("/createPost", httpHandler.AuthCheckFunc, httpHandler.CreatePost)
		post.POST("/delPost", httpHandler.AuthCheckFunc, httpHandler.DelPost)
		post.POST("/updatePost", httpHandler.AuthCheckFunc, httpHandler.UpdatePost)
		post.POST("/deletePostList", httpHandler.AuthCheckFunc, httpHandler.DeletePostList)
		post.POST("/getPostList", httpHandler.GetPostList)
		post.POST("/operate", httpHandler.AuthCheckFunc, httpHandler.PostOperate)
		post.POST("/detail", httpHandler.PostDetail)
		post.POST("/record", httpHandler.PostRecord)

		post.POST("/like", httpHandler.AuthCheckFunc, httpHandler.PostLike)
		post.POST("/unlike", httpHandler.AuthCheckFunc, httpHandler.PostUnLike)

		post.POST("/commentCreate", httpHandler.AuthCheckFunc, httpHandler.CommentCreate)
		post.POST("/commentReply", httpHandler.AuthCheckFunc, httpHandler.CommentReply)
		post.GET("/commentPage", httpHandler.CommentPage)
		post.POST("/commentLike", httpHandler.AuthCheckFunc, httpHandler.CommentLike)
		post.POST("/commentDelete", httpHandler.AuthCheckFunc, httpHandler.CommentDelete)
		post.GET("/commentFind", httpHandler.CommentFind)

		post.GET("/topic/search", httpHandler.TopicSearch)
		post.GET("/topic/detail", httpHandler.TopicDetail)

		post.GET("/myCampingData", httpHandler.MyCampingData)
		post.POST("/followList", httpHandler.AuthCheckFunc, httpHandler.FollowList)
		post.GET("/recommendList", httpHandler.RecommendList)
		post.GET("/nearByList", httpHandler.NearByList)
		post.POST("/punchList", httpHandler.PunchList)
		post.POST("/punchRecommendList", httpHandler.PunchRecommendList)

		post.POST("/createSubject", httpHandler.AuthCheckFunc, httpHandler.CreateSubject)
		post.POST("/updateSubject", httpHandler.AuthCheckFunc, httpHandler.UpdateSubject)
		post.POST("/deleteSubjectList", httpHandler.AuthCheckFunc, httpHandler.DeleteSubjectList)
		post.POST("/getSubjectList", httpHandler.GetSubjectList)
		post.GET("/subject/list", httpHandler.SubjectList)
		post.POST("/subjectPost/create", httpHandler.AuthCheckFunc, httpHandler.SubjectPostCreate)
		post.GET("/subjectContent/list", httpHandler.SubjectContentList)

	}

	activity := g.Group("/activity")
	{
		activity.POST("/createActivity", httpHandler.AuthCheckFunc, httpHandler.CreateActivity)
		activity.POST("/updateActivity", httpHandler.AuthCheckFunc, httpHandler.UpdateActivity)
		activity.POST("/deleteActivityList", httpHandler.AuthCheckFunc, httpHandler.DeleteActivityList)
		activity.POST("/getActivityList", httpHandler.GetActivityList)

		activity.GET("/recommendList", httpHandler.ActivityRecommendList)
		activity.GET("/list", httpHandler.ActivityList)
		activity.GET("/listForCamp", httpHandler.ActivityListForCamp)
		activity.GET("/detail", httpHandler.ActivityDetail)
	}

	product := g.Group("/product")
	{
		product.POST("/create", httpHandler.AuthCheckFunc, httpHandler.CreateProduct)
		product.GET("/listForCamp", httpHandler.ProductListForCamp)
	}

	coupon := g.Group("/coupon")
	{
		coupon.GET("/onlineCouponList", httpHandler.CouponListForCamp)
	}

}
